create or replace procedure findname(pstuid char) AS

--declare program variables

	plastname	char(20);	
	pfirstname	char(20);	

BEGIN
	-- query to find the first and last name of the student
	SELECT 	firstname, lastname
	INTO		pfirstname, plastname
	FROM		Student
	WHERE		stuId = pstuId;

	-- display the name
	DBMS_OUTPUT.PUT_LINE('Student name: ' || RTRIM(pfirstname) 
	|| ' ' || RTRIM(plastname));

	exception
	when no_data_found then 
		DBMS_OUTPUT.PUT_LINE('No data found');
	when others then
		DBMS_OUTPUT.PUT_LINE('Error-' || SQLERRM);

end;


/
